

import multiprocessing
import time

# 子任务work
def work():
    for i in range(10):
        print("工作中...")
        time.sleep(0.2)  # 2秒钟才能赶完


if __name__ == '__main__':

    # 创建子任务
    p1 = multiprocessing.Process(target=work)
    p1.start()

    time.sleep(1)

    print('主进程执行代码完毕...')